# Contributor: Laurent Bercot <ska-devel@skarnet.org>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=mdevd
pkgver=0.1.6.5
pkgrel=1
pkgdesc="A netlink-listening device manager using mdev's configuration files"
url=https://skarnet.org/software/mdevd/
arch="all"
license="ISC"
options="!check"  # no tests provided
_skalibs_version=2.14.3
depends_openrc="mdevd mdev-conf"
makedepends="linux-headers skalibs-dev>=${_skalibs_version}"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://skarnet.org/software/mdevd/mdevd-$pkgver.tar.gz
	$pkgname.initd
	mdevd-init.initd"

build() {
	./configure \
		--prefix=/usr \
		--enable-shared \
		--disable-allstatic
	make
}

package() {
	make install DESTDIR="$pkgdir"
	mkdir -p "$pkgdir/usr/share/doc" "$pkgdir/etc/init.d"
	cp -a doc "$pkgdir/usr/share/doc/$pkgname"
	install -m 755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m 755 "$srcdir"/mdevd-init.initd "$pkgdir"/etc/init.d/mdevd-init
}

openrc() {
	provides="dev-openrc"
	provider_priority=20
	default_openrc
}

sha512sums="
a6d4fd9802e46746b7c677bf1c5d496f7af46eb3d827248781989c0cfcd81e14b5eb7ab6af6aef9be6f3b3f1bc4fa6de1a61735f2fc2aa6b7dc994b0f73999f7  mdevd-0.1.6.5.tar.gz
8e139779b19a062abad601522c2d006d6dd21f1c7f99eeb1f5f061b75cf8cccb71019665468f9cd99429affd8236b5bc345691bdc8db0807d55faa388efb6849  mdevd.initd
a1e4734b1ad1a508da6c035aa9523a465cfd44489cceb7552f3b6e94ca8b8fb39e6baa3b230388ff9e89c1edbdcac5682f4c636b9fe52d94a92ac98f55bdd972  mdevd-init.initd
"
